using System;
using Tools.Common.UnitOfWork.Contracts;
using NHibernate;

namespace Web.App.Infrastructure.UnitOfWork.Implementations
{
    public class NHibernateUoWFactory : IUnitOfWorkFactory
    {
        private ISessionFactory sessionFactory;

        public NHibernateUoWFactory(ISessionFactory sessionFactory)
        {
            this.sessionFactory = sessionFactory;
        }

        public IUnitOfWork Create(Tools.Common.UnitOfWork.ConversationType conversationType)
        {
            return new NHibernateUoW(
                                        sessionFactory.OpenSession(), 
                                        conversationType, 
                                        Guid.NewGuid()
                                    );
        }

        public IUnitOfWork Create(Tools.Common.UnitOfWork.ConversationType conversationType, IUoWInterceptorWrapper interceptor)
        {
            throw new System.NotImplementedException();
        }
    }
}